package com.youbu.bigdata.bean;

import com.youbu.bigdata.constant.SparkConfEnum;
import org.apache.spark.SparkConf;

import java.util.Map;

/**
 * Spark设置类
 * @author sunfangwei
 **/
public class YbSparkConfig {

	private SparkConf sparkConf;

	public YbSparkConfig() {
		this.sparkConf = new SparkConf();
	}

	/**
	 * 获取sparkConf.
	 */
	public SparkConf getSparkConf() {
		return sparkConf;
	}

	/**
	 * 设置键和值
	 * @param sparkConfEnum
	 * @param value
	 */
	public void setConfKeyAndValue(SparkConfEnum sparkConfEnum,String value){
		sparkConf.set(sparkConfEnum.getValue(),value);
	}

	public void setConfKeyAndValue(Map<String,String> configMap){
		this.sparkConf = new SparkConf();
		for(String key:configMap.keySet()){
			this.sparkConf.set(key,configMap.get(key));
		}
	}


}
